package com.dao;

import com.pojo.Msg;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import java.util.List;

public interface MsgDao {

    @Select("select * from msg where receiver=#{receiver} order by time desc limit #{page},#{pageSize};")
    List<Msg> getByPage(int page,int pageSize,String receiver);

    @Select("select count(*) from msg where receiver=#{receiver};")
    int getCount(String receiver);

    @Insert("insert into msg values(null,#{sender},#{receiver},#{message},#{time});")
    void add(Msg msg);

    @Delete("delete from msg where id=#{id};")
    void delete(String id);
}
